From d89d92d3936683f4212186cef517c7930dd5b33a Mon Sep 17 00:00:00 2001 From: Ashelyn Rose Date: Mon, 8 May 2023 19:25:46 -0600 Subject: add markdown rendering, copy in old posts --- app/posts/[slug]/page.tsx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 app/posts/[slug]/page.tsx (limited to 'app/posts/[slug]/page.tsx') diff --git a/app/posts/[slug]/page.tsx b/app/posts/[slug]/page.tsx new file mode 100644 index 0000000..2110a35 --- /dev/null +++ b/app/posts/[slug]/page.tsx @@ -0,0 +1,28 @@ +import { notFound } from 'next/navigation' +import Markdown from 'markdown-to-jsx' + +import InfoBar from '~/components/InfoBar' +import { getPostSlugs, loadSinglePage } from '~/utils/post' + +export async function generateStaticParams() { + const slugs = await getPostSlugs() + return slugs.map((slug: string) => ({ slug })) +} + +export default async function Post({ params: { slug } }) { + const post = await loadSinglePage(slug) + if (!post) notFound() + + return ( + <> +

+ {post.title} +

+
+ + {post.body} +
+ + ) +} + -- cgit 1.4.1